Gnc.SexSelect = function () {
    Gnc.SexSelect.superclass.constructor.call(this);
    this.data=[
                { name: "女", id: 0 },
                { name: "男", id: 1 }
              ];
    this.set({
        ajaxOptions:{type:'GET'},
        border: 1,
        emptyText: '请选择...',
        valueField:'id',
        textField:'name',
        data:this.data
    });
};
mini.extend(Gnc.SexSelect,  mini.ComboBox, {
    uiCls: "gnc-sexselect",
    url: '',
    selectedItem: null,
    autoLoad: false,
    loaded:false,
    _create: function () {
        Gnc.SexSelect.superclass._create.call(this);
         this.on('valuechanged',function(record){
            this.selectedItem = record.selected;
            this.fire('sexSelected',this.selectedItem);
        },this);
        this.on('closeclick',function(e){
            var obj = e.sender;
            this.setNameValue('','');
            this.fire('sexCleared');
        },this);
    },
    //清空
    removeAll:function(){
        this.setNameValue('','');
        this.setData([]);
    },
    setValue:function(value){
        Gnc.SexSelect.superclass.setValue.call(this,value)
        for (var i = 0, j = this.data.length; i < j; i++) {
            var data = this.data[i];
            if (data.id == value)
                this.setText(data.name);
        }
    },
    setNameValue:function(name,value){
        this.setValue(value);
        this.setText(name);
    }
});
mini.regClass(Gnc.SexSelect, "Gnc.SexSelect");